

#include <string.h>
#include "SimpleTag.h"


void SimpleTag_Set(SimpleTag_T* tag, uint8_t type, uint8_t uid_bit, uint8_t uid_len, const void* uid){
	memcpy(tag->uid, uid, uid_len);
	tag->ulen = uid_len;
	tag->ubit = uid_bit;
	tag->type = type;
}

int SimpleTag_Compare(const SimpleTag_T* tag1, const SimpleTag_T* tag2){
	if(tag1->type != tag2->type){
		return 1;
	}
	
	if(tag1->ulen == 0){
		return 2;
	}

	if(tag1->ulen != tag2->ulen){
		return 2;
	}

	if(memcmp(tag1->uid, tag2->uid, tag1->ulen)){
		return 3;
	}
	
	return 0;
}

void SimpleTag_Clear(SimpleTag_T* tag){
	tag->ulen = 0;
}


